package com.vodone.v1pin.detail.service
{
	import com.vodone.v1pin.ServiceProvider;
	import com.vodone.v1pin.core.service.HttpJsonDelegate;
	
	import mx.rpc.http.mxml.HTTPService;

	public class SizeDelegate
	{
		/**
		 * 
		 * @param id 用户id
		 * @param name 尺码名称
		 * @param shoulder 肩宽
		 * @param bust 胸围
		 * @param brachium 臂长
		 * @param waistline 腰围
		 * @param hipline 臀围
		 * @param legOpening 腿长
		 * @param resultHandler
		 * @param faultHandler
		 * 
		 */		
		public static function addSize( id:String ,name:String ,shoulder:String , bust:String ,
										brachium:String , waistline:String , hipline:String , legOpening:String ,
										resultHandler:Function , faultHandler:Function ):void
		{
			var service:HTTPService = ServiceProvider.getInstance().addSizeService;
			var params:Object = {
				userid:id,
				name:name,
				shoulder:shoulder,
				bust:bust,
				brachium:brachium,
				waistline:waistline,
				hipline:hipline,
				legOpening:legOpening
			};
			var delegate:HttpJsonDelegate = new HttpJsonDelegate( service );
			delegate.send( params , resultHandler , faultHandler );
		}
		/**
		 * 
		 * @param id 尺码id
		 * @param resultHandler
		 * @param faultHandler
		 * 
		 */		
		public static function deleteSize( id:String , resultHandler:Function , faultHandler:Function ):void
		{
			var service:HTTPService = ServiceProvider.getInstance().deleteSizeService;
			var params:Object = {
				mysizeid:id
			};
			var delegate:HttpJsonDelegate = new HttpJsonDelegate( service );
			delegate.send( params , resultHandler , faultHandler );
		}
		/**
		 * 
		 * @param userid 用户id
		 * @param id 尺码id
		 * @param name 尺码名称
		 * @param shoulder 肩宽
		 * @param bust 胸围
		 * @param brachium 臂长
		 * @param waistline 腰围
		 * @param hipline 臀围
		 * @param legOpening 腿长
		 * @param isDefault 是否是默认尺码
		 * @param resultHandler
		 * @param faultHandler
		 * 
		 */		
		public static function updateSize( userid:String , id:String , name:String ,shoulder:String , bust:String ,
										   brachium:String , waistline:String , hipline:String , legOpening:String ,isDefault:Boolean,
										   flag:String , resultHandler:Function , faultHandler:Function ):void
		{
			var service:HTTPService = ServiceProvider.getInstance().updateSizeService;
			var params:Object = {
				mysizeid:id,
				userid:userid,
				name:name,
				shoulder:shoulder,
				bust:bust,
				brachium:brachium,
				waistline:waistline,
				hipline:hipline,
				legOpening:legOpening,
				defaultType: isDefault ? 1 : 0,
				flag:flag
			};
			var delegate:HttpJsonDelegate = new HttpJsonDelegate( service );
			delegate.send( params , resultHandler , faultHandler );
		}
		/**
		 * 
		 * @param userid 用户id
		 * @param type 0表示全部，1表示默认
		 * @param resultHandler
		 * @param faultHandler
		 * 
		 */		
		public static function getDefaultSize( userid:String , type:int , resultHandler:Function , faultHandler:Function ):void
		{
			var service:HTTPService = ServiceProvider.getInstance().getSizeService;
			var params:Object = {
				userid:userid,
				type:type
			};
			var delegate:HttpJsonDelegate = new HttpJsonDelegate( service );
			delegate.send( params , resultHandler , faultHandler );
		}
	}
}